//
//  KSOrderTableViewCell.swift
//  Supermarket
//
//  Created by Black_Crystal on 2017/9/25.
//  Copyright © 2017年 kushao. All rights reserved.
//

import UIKit

class KSOrderTableViewCell: UITableViewCell {

    private var orderNumberLabel = UILabel()
    private var orderState = UILabel()
    private var nameLabel = UILabel()
    private var phoneLabel = UILabel()
    private var addressLabel = UILabel()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        self.selectionStyle = .none
        self.backgroundColor = KSColor.kColorViewBackground
        
        let backView = UIView()
        backView.backgroundColor = UIColor.white
        self.contentView.addSubview(backView)
        backView.snp.makeConstraints { (make) in
            make.edges.equalTo(UIEdgeInsets.init(top: 10, left: 0, bottom: 0, right: 0))
        }
        
        let orderLabel = UILabel()
        orderLabel.text = "订单号"
        orderLabel.textColor = KSColor.kColor_3
        orderLabel.font = UIFont.systemFont(ofSize: 16)
        backView.addSubview(orderLabel)
        orderLabel.snp.makeConstraints { (make) in
            make.top.equalTo(20)
            make.left.equalTo(10)
            make.width.equalTo(100)
        }
        
        orderNumberLabel.text = "123123123123"
        orderNumberLabel.textColor = KSColor.kColor_3
        orderNumberLabel.font = UIFont.systemFont(ofSize: 15)
        backView.addSubview(orderNumberLabel)
        orderNumberLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(orderLabel)
            make.left.equalTo(orderLabel.snp.right)
        }
        
        orderState.text = "配送中"
        orderState.font = UIFont.systemFont(ofSize: 17)
        backView.addSubview(orderState)
        orderState.snp.makeConstraints { (make) in
            make.centerY.equalTo(orderLabel)
            make.right.equalTo(-10)
        }
        
        let lineView = UIView()
        lineView.backgroundColor = KSColor.kColor_line
        backView.addSubview(lineView)
        lineView.snp.makeConstraints { (make) in
            make.left.right.equalTo(0)
            make.top.equalTo(orderLabel.snp.bottom).offset(10)
            make.height.equalTo(1)
        }
        
        nameLabel.text = "哈哈哈哈哈"
        nameLabel.textColor = KSColor.kColor_3
        nameLabel.font = UIFont.systemFont(ofSize: 14)
        backView.addSubview(nameLabel)
        nameLabel.snp.makeConstraints { (make) in
            make.left.equalTo(10)
            make.top.equalTo(lineView.snp.bottom).offset(20)
            make.width.equalTo(100)
        }
        
        phoneLabel.text = "12312312331"
        phoneLabel.textColor = KSColor.kColor_3
        phoneLabel.font = UIFont.systemFont(ofSize: 14)
        backView.addSubview(phoneLabel)
        phoneLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(nameLabel)
            make.left.equalTo(nameLabel.snp.right)
        }
        
        addressLabel.text = "asdadadsdasdasdasd是打算大所大所大所大奥所大大所大所大所多"
        addressLabel.numberOfLines = 0
        addressLabel.textColor = KSColor.kColor_9
        addressLabel.font = UIFont.systemFont(ofSize: 14)
        backView.addSubview(addressLabel)
        addressLabel.snp.makeConstraints { (make) in
            make.top.equalTo(nameLabel.snp.bottom).offset(10)
            make.left.equalTo(10)
            make.right.equalTo(-10)
        }
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
